import numpy as np
import torch
from sklearn.metrics import accuracy_score

from classification.bert_fc.bert_fc_predictor import BertFCPredictor
from classification.bert_fc.bert_fc_trainer import BertFCTrainer

# 设置随机种子
seed = 0
torch.manual_seed(seed)  # torch cpu随机种子
torch.cuda.manual_seed_all(seed)  # torch gpu随机种子
np.random.seed(seed)  # numpy随机种子


def process(sentence):
    titles=[]
    titles.append(list(sentence))
    return titles

#实例化predictor，加载模型
predictor = BertFCPredictor(
    pretrained_model_dir='./model/cino-small-v2', model_dir='./tmp/cinofc',
    enable_parallel=True
)
sentence="我好难过，好坏"
ss=process(sentence)
predict_labels = predictor.predict(ss, batch_size=1)
print(predict_labels[0])

# # 评估
# test_acc = accuracy_score(test_labels, predict_labels)
# print('test acc:', test_acc)
